package com.craterhill.java.ccp.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.craterhill.java.ccp.common.beans.Position;
import com.craterhill.java.ccp.dao.impl.AbstractDao;
import com.craterhill.java.ccp.dao.utils.CCPResultSetExtractor;

public interface PositionDao extends CCPDao<Position> {

	public final String FIELD_LIST = "obj.position_id, obj.position_name"
			+ AbstractDao.MONITER_FIELDS;

	public final String FIND_ALL_POSITION = "select " + FIELD_LIST + " from position obj";

	public final class PositionExtractor extends CCPResultSetExtractor<Position> {

		@Override
		protected Position extractResultSetData(ResultSet resultSet) throws SQLException {
			Position position = new Position();
			position.setPositionId(resultSet.getInt(1));
			position.setPositionName(resultSet.getString(2));
			position.setStatus(resultSet.getBoolean(3));
			position.setCreatedBy(resultSet.getInt(4));
			position.setModifiedBy(resultSet.getInt(5));
			position.setCreatedDate(resultSet.getDate(6));
			position.setModifiedDate(resultSet.getDate(7));
			return position;
		}
	}

}
